<%-- 
    Document   : sessiondemo
    Created on : 2024年4月21日, 上午10:03:53
    Author     : JUST
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Session!</h1>
        <%
            Integer count = (Integer)session.getAttribute("count");
            if(count==null){
                count=1;
            }else{
                count++;
            }
            session.setAttribute("count", count);
            
            Integer appCount = (Integer)application.getAttribute("count");
            if(appCount==null){
                appCount=1;
            }else{
                appCount++;
            }
            application.setAttribute("count",appCount);
            
        %>
        <h2>session:<%=count%></h2>
        <h2>application:<%=appCount%></h2>
    </body>
</html>
